﻿using System;
using System.Linq;

namespace _02.FilesAndFoldersTree
{
    class FilesAndFoldersTree
    {
        static void Main(string[] args)
        {
            Folder folder = new Folder(@"C:\Windows\Temp");

            Console.WriteLine("Directory of {0}\n", folder.Name);

            Console.WriteLine("Files in {0} - {1} bytes", folder.Name, folder.FilesSize);
            foreach (var subfolder in folder.ChildFolders)
            {
                Console.WriteLine("{0} - {1} bytes", subfolder.Name, subfolder.CalculateTotalFilesSize());
            }

            Console.WriteLine("\nTotaly: {0} bytes in {1} files and {2} folders",
                folder.CalculateTotalFilesSize(), folder.Files.Count, folder.ChildFolders.Count);
        }
    }
}
